<template>
	<view @touchstart="handleTouchStart">
		<cu-custom bgColor="bg-gradual-pink" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">发料</block>
		</cu-custom>
		<form>
			<view class="cu-form-group">
				<view class="title">外协厂商</view>
				<view class="action some-class" style="width: 60%;margin-right: 60px;">
					<!-- 					<uni-data-select v-model="myFormData.supplierId" style="font-size: 12px;height: 30px;"
						:localdata="sortSupps" @change="changeSupp"></uni-data-select> -->
						<!-- style="flex: 1; height: 20rpx; border: 1rpx solid #ccc; font-size: 30rpx;" -->
						<custom-down-search		
							ref="selSupp"
							:options="sortSuppstext"
							:localdata="sortSupps"
							:value="myFormData.supplierId"
							v-model="myFormData.supplierId"
							@changeInput="changeSupp"
							@input="handleInput2"
						></custom-down-search>
						<!-- <MySelect v-model="myFormData.supplierId" dictCode='yn'></MySelect> -->
				</view>
			</view>
			<view class="cu-form-group">
				<view class="title">工单号输入:</view>
				<input placeholder="请输入工单号" disabled="true" name="input" v-model="myFormData.workOrderNumber"></input>
				<button v-if="itemChilds.length>0" class="cu-btn bg-yellow lg" @click="openSubOrder" >子工单</button>
			</view>
			<view class="cu-form-group">
				<view class="title">工序选择</view>
				<view class="action" :style="{width: '60%',marginRight: '60px',backgroundColor: bgColor}">					
					<uni-data-select :disabled="empProcess" v-model="myFormData.id"
						style="font-size: 12px;height: 30px;" :localdata="range" @change="change"></uni-data-select>
				</view>
			</view>
			<!-- 			<view class="cu-form-group">
				<view class="title">工单数量</view>
				<view class="action">
					<text class="text-grey">{{myFormData.qtyWorkOrder}}</text>
				</view>
			</view> -->
			<view class="cu-form-group">
				<view class="title" style="width:300px;">可外发数量:</view>
				<view class="action" style="width:222px;">
					<text class="text-grey">{{myFormData.balanceQty}}</text>
				</view>
				<view style="width:300px;">
					<button v-if="queryAbnVisual" class="cu-btn bg-gradual-orange lg" @click="queryAbn" >异常记录</button>
				</view>
			</view>
			<view class="cu-form-group">
				<view class="title" style="width:200px;">客户料号:</view>
				<view class="action" style="width:222px;">
					<text class="text-grey">{{myFormData.custCode}}</text>
				</view>
			</view>
			<view class="cu-form-group">
				<view class="title" style="width:200px;">产品名称:</view>
				<view class="action" style="width:222px;">
					<text class="text-grey">{{myFormData.name}}</text>
				</view>
			</view>
			<!-- 			<view class="cu-form-group">
				<view class="title">版本</view>
				<view class="action">
					<text class="text-grey">{{myFormData.productVer}}</text>
				</view>
			</view> -->
			<view class="cu-form-group">
				<view class="title" style="font-size: 42rpx;">外发数量:</view>
				<input ref="inputName" :focus="focusState" class="input-class" type="number" placeholder="输入完工数量"
					name="input"  selection-start="0" :selection-end="numLength"  v-model="myFormData.qty" @input="changeQty"></input>
			</view>
			<view class="cu-form-group container-btn">
				<button :disabled="buttonActions.disabledScan" class="cu-btn bg-blue lg" @click="scan(2)">继续扫</button>
				<button v-if="!buttonActions.hiddenProcess" :disabled="buttonActions.disabledProcess" style="margin-left: 10px;" class="cu-btn bg-blue lg" @click="addProcess">无工单</button>

			</view>
			<view class="example-body">
				<drawer ref="showLeft" :show="productDrawerShow" @cancel="productDrawerCancel" @ensure="productDrawerEnsure" >					
					<view style="margin-top: 80px;">
						<view class="cu-form-group">
							<view class="title">查询:</view>
							<input ref="searchVal" class="input-class" placeholder="输入查询"
							v-model="searchVal" @input="changeSearchVal"></input>
						</view>
                  <view style="overflow-x: auto;">
					<uni-table ref="processTable" :loading="loading" border stripe type="selection" emptyText="暂无更多数据" 
										@selection-change="selectionChangeProcess">
						<uni-tr>
						    <uni-th width="150" align="center">客户料号</uni-th>
							<uni-th width="150" align="center">工序</uni-th>

							<uni-th width="150" align="center">名称</uni-th>
							<uni-th width="150" align="center">产品代码</uni-th>
							<uni-th width="150" align="center">产品名称</uni-th>
						</uni-tr>
						<uni-tr v-for="(item, index) in processOPList" :key="index"
							:class="{ 'highlight-row': isRowHighlighted(item) }">
							<uni-td>{{ item.custCode }}</uni-td>
							<uni-td>{{ item.processName }}</uni-td>

									<uni-td>{{ item.name }}</uni-td>
										<uni-td>{{ item.code }}</uni-td>
										<uni-td>{{ item.name }}</uni-td>

						</uni-tr>
					</uni-table>

					<view class="uni-pagination-box"><uni-pagination show-icon :page-size="processPageSize" :current="processPageCurrent" :total="processTotal" @change="changeProcessPage" /></view>
                     </view>
					</view>
<!-- 						<view class="close">
						    <button v-if="displayProcessConfirm" @click="closeDrawer('showLeft')"><text
											class="word-btn-white">确定</text></button>
							<button v-else @click="closeDrawer('showLeft')"><text
											class="word-btn-white">返回</text></button>
						</view>
						 -->
					</drawer>
			</view>
		</form>
		<view style="margin-top: 10px;">
			<view v-if="!repeatPrint">
			<uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据"
				@selection-change="selectionChange">
				<uni-tr>
					<uni-th width="20" align="center">序号</uni-th>
					<uni-th width="150" align="center">客户料号</uni-th>
					<uni-th width="100" align="center">产品名称</uni-th>
					<uni-th width="100" align="center">工序</uni-th>
					<uni-th width="100" align="center">数量</uni-th>
					<uni-th width="200" align="center">备注</uni-th>
					<uni-th width="204" align="center">设置</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index"
					:class="{ 'highlight-row': isRowHighlighted(item) }">
					<uni-td align="center">{{index + 1}}</uni-td>
					<uni-td align="center">{{ item.custCode }}</uni-td>
					<uni-td align="center">{{ item.productName }}</uni-td>
					<uni-td align="center">
						<view class="name">{{ item.processId_dictText }}</view>
					</uni-td>
					<uni-td align="center">
						<input placeholder="请输入数量" name="input" :disabled="item.item_id" v-model="item.qty"></input>
					</uni-td>
					<uni-td align="center">
					<!-- {{ item.remark }} -->
					<input placeholder="请输入备注" name="input" @input="changeRemark" v-model="item.remark"></input>
					</uni-td>
					<uni-td>
						<view class="uni-group">
							<!-- <button class="uni-button" size="mini" type="primary">修改</button> -->
							<button class="uni-button" v-show="!item.item_id" size="mini" @tap="delTable(index,item,$event)"
								type="warn">删除</button>
						</view>
					</uni-td>
				</uni-tr>
			</uni-table>
			</view> 
			<view v-else>
				<uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据"
					@selection-change="selectionChangeOrder">
					<uni-tr>
						<uni-th width="20" align="center">序号</uni-th>
						<uni-th width="150" align="center">外发单号</uni-th>
						<uni-th width="150" align="center">厂商名称</uni-th>
						<uni-th align="center">状态</uni-th>
						<uni-th align="center">需求日期</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in orderData" :key="index"
						:class="{ 'highlight-row': isRowHighlighted(item) }">
						<uni-td align="center">{{ index + 1 }}</uni-td>
						<uni-td align="center">{{ item.outsourceNo }}</uni-td>
						<uni-td align="center">
							<view class="name">{{ item.supplierId_dictText }}</view>
						</uni-td>
						<uni-td align="center">{{ item.status_dictText }}</uni-td>
						<uni-td align="center">{{ item.requestDate }}</uni-td>

					</uni-tr>
				</uni-table>
				<view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total" @change="changePage" /></view>
			</view>
		</view>
		
		<view class="cu-form-group container-btn">
			<button v-if="!buttonActions.hiddenDetail" :disabled="buttonActions.disabledDetail" class="cu-btn bg-green lg"  @click="handelDetail()">详情</button>
			<button v-if="!buttonActions.hiddenReturn" :disabled="buttonActions.disabledReturn"  class="cu-btn bg-green lg" @click="handelReturn()" style="margin-left: 10px;">返回</button>
			<button v-if="!buttonActions.hiddenConfirm" :disabled="buttonActions.disabledConfirm" class="cu-btn bg-blue lg" @click="onSubmit(0)" style="margin-left: 10px;">确定</button>
			<button v-if="!buttonActions.hiddenPrint" :disabled="buttonActions.disabledPrint" class="cu-btn bg-green lg" @click="handlePrint()"	style="margin-left: 10px;">打印</button>				
			<!-- <button class="cu-btn bg-red lg" @click="onSubmit(1)" style="margin-left: 10px;">全部转</button> -->
		</view>
		<view class="cu-form-group">
		</view>
		
<view class="example-body">
				<drawer :show="subOrderDrawerShow" @cancel="subOrderCancel" @ensure="subOrderEnsure" >
				<!--            <view>右往左滑动</view>
				            <view>自定义内容</view>		 -->	
							<view style="margin-top: 140rpx;">
							<uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据" @selection-change="selectionChange">
								<uni-tr>
									<uni-th width="50" align="center">序号</uni-th>		
									<uni-th width="150" align="center">工单号</uni-th>
									<uni-th width="150" align="center">客户</uni-th>
									<uni-th width="120" align="center">产品编码</uni-th>
									<uni-th width="150" align="center">客户料号</uni-th>
									<uni-th width="120" align="center">图号</uni-th>
								    <uni-th width="120" align="center">产品名称</uni-th>
									<uni-th width="150" align="center">版本</uni-th>
									<uni-th width="120" align="center">数量</uni-th>
									<uni-th width="120" align="center">下单日期</uni-th>	
								    <uni-th width="120" align="center">需求日期</uni-th>									
								</uni-tr>
								<uni-tr v-for="(item, index) in itemChilds" :key="index">
									<uni-td>{{ (index + 1) }}</uni-td>
									<uni-td>{{ item.workOrderNumber }}</uni-td>
									<uni-td>{{ item.customerShortName }}</uni-td>
									<uni-td>{{ item.code }}			</uni-td>
									<uni-td>		{{item.custCode}}		</uni-td>
                                    <uni-td>		{{item.drawingNo}}		</uni-td>
									<uni-td>		{{item.name}}		</uni-td>
									<uni-td>		{{item.productVer}}		</uni-td>
									<uni-td>		{{item.qty}}		</uni-td>
									<uni-td>		{{item.orderDate ? item.orderDate : '' }}		</uni-td>
									<uni-td>		{{item.deliveryDate ? item.deliveryDate : '' }}		</uni-td>
								</uni-tr>
							</uni-table>
							<view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total" @change="changePage" /></view>
				            </view>
						</drawer>	
			</view>			
		
		<view class="example-body">
		        <drawer :show="drawerShow" @cancel="cancel" @ensure="ensure" >
		<!--            <view>右往左滑动</view>
		            <view>自定义内容</view>		 -->	
					<view style="margin-top: 140rpx;">
					<uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据" @selection-change="selectionChange">
						<uni-tr>
							<uni-th width="50" align="center">序号</uni-th>					
							<uni-th width="150" align="center">客户料号</uni-th>
							<uni-th width="120" align="center">日期</uni-th>
							<uni-th width="150" align="center">问题描述</uni-th>
							<uni-th width="120" align="center">不良图片</uni-th>
							
		<!-- 					<uni-th align="center">地址</uni-th>
							<uni-th width="204" align="center">设置</uni-th> -->
						</uni-tr>
						<uni-tr v-for="(item, index) in abnTableData" :key="index">
							<uni-td>{{ (index + 1) }}</uni-td>
							<uni-td>{{ item.custCode }}</uni-td>
							<uni-td>{{ item.samplingDate }}</uni-td>
							<uni-td>
								<view @click="open(item.abnormalDescription)" class="name">{{ item.abnormalDescription ? item.abnormalDescription: ""}}</view>
							</uni-td>
							<uni-td>
								<view>
								    <image
								      class="image"
								      :src="getImage(item)"
								      @click="previewImage($event,item,index)"							  
								    ></image>
								  </view>
							</uni-td>
							<!-- <uni-td align="center">{{ item.address }}</uni-td> -->
		<!-- 					<uni-td>
								<view class="uni-group">
									<button class="uni-button" size="mini" type="primary">修改</button>
									<button class="uni-button" size="mini" type="warn">删除</button>
								</view>
							</uni-td> -->
						</uni-tr>
					</uni-table>
					<view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total" @change="change" /></view>
		            </view>
				</drawer>	
				</view>
		<!-- <view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total" @change="change" /></view> -->
	</view>
</template>

<script>
	import api from '@/api/api.js'
	import {
		USER_INFO,
		SASS_DOMAIN_ID,
		SASS_TENANT_ID,
		SASS_DOMAIN_NAME
	} from "@/common/util/constants"
	import {
		forEach
	} from "../../common/luch-request/utils";
	import socket from '@/common/js-sdk/socket/socket.js'
	// import CustomDownSearch from '../../components/my-components/custom-down-search.vue'
	import MySelect from '@/components/my-componets/my-select.vue'
	import CustomDownSearch from '@/components/my-componets/custom-down-search.vue'
	export default {
		name: 'inputOpmProcessQty',
		components: {
			CustomDownSearch,
			MySelect,
		},
		data() {
			return {
				productDrawerShow:false,
				stext:['one','two','three'],
				// disabledPrint: true,
				bgColor:'white',
				index: -1,
				switchC: true,
				empProcess: false,
				queryAbnVisual:false,
				drawerShow:false,
				searchVal : '',
				imgList: [],
				range: [],
				suppliers: [],
				buffSuppliers: [],
				processOPList:[],
				sortSupps: [],
				sortSuppstext:[],
				numLength:0,
				uploadUrl: "/sys/common/upload",
				processIds: '',
				selectedId: '',
				workprocess: null,
				userInfo: null,
				focusState: false,
				selectedProcess:false,
				selectedSupp : {},
				displayProcessConfirm:false,
				
				itemChilds : [],
				createQrcodeInCad : false,
				subOrderDrawerShow:false,
				
				// isAddProcess: false,
				isOrderChange: false,
				myFormData: {
					customerAddress: '',
					contacts: '',
					customerTell: '',
					outsourceNo: '',
					supplierId:'',
					
				},
				mastData:{},
				outsourceNo: '',
				title: 'uni-fab',
				directionStr: '垂直',
				horizontal: 'right',
				vertical: 'top',
				direction: 'horizontal',
				pattern: {
					color: '#7A7E83',
					backgroundColor: '#fff',
					selectedColor: '#007AFF',
					buttonColor: '#007AFF',
					iconColor: '#fff',
					icon: 'scan'
				},
				is_color_type: false,
				content: [{
						iconPath: '/static/image.png',
						selectedIconPath: '/static/image-active.png',
						text: '相册',
						active: false
					},
					{
						iconPath: '/static/home.png',
						selectedIconPath: '/static/home-active.png',
						text: '首页',
						active: false
					},
					{
						iconPath: '/static/star.png',
						selectedIconPath: '/static/star-active.png',
						text: '收藏',
						active: false
					}
				],
				url:{
					querySupplierDefaultById: '/bas/basSupplier/default',
					getByMainId: '/opm/opmOutsourceProcess/queryOpmOutsourceProcessItemByMainId',
					saveShareLink : '/opm/opmOutsourceProcess/saveShareLink'
				},
				customNumberConfig: {
					ruleField: 'outsourceNo',
					ruleCode: 'outsource_no', //pom_delivery_note_no
					ruleName: '外协单编码',
					ruleUrl: '/sys/fillRule/executeRuleByCode/',
				},
				searchVal: '',
				repeatPrint:false,
				orderData: [],
				tableData: [],
				abnTableData:[],
				// 每页数据量
				pageSize: 10,
				processPageSize : 10,
				// 当前页
				pageCurrent: 1,
				processPageCurrent: 1,
				// 数据总量
				total: 0,
				processTotal: 0,
				loading: false,
				// disabledDataInputFlag:false,
				// isDetailReturn:false,
				scanSource:"normal",
				buttonActions : {
					disabledPrint:false,
					disabledReturn:false,
					disabledConfirm:false,
					disabledDetail:false,
			        hiddenPrint:false,
					hiddenReturn:false,
					hiddenConfirm:false,
					hiddenDetail:false,
					disabledScan:false,
					disabledProcess:false,
					hiddenScan:false,
					hiddenProcess:false,
				},
				// url: {
				// 	querySupplierDefaultById: '/bas/basSupplier/default',
				// }
			};
		},
		onLoad: function(option) {
			// this.getEmployee()
			this.selectedIndexs = []
			this.processSelectedIndexs = []
		},		
		created() {
			this.userInfo = uni.getStorageSync(USER_INFO)
			this.myFormData.employee = this.userInfo.username
			this.myFormData.employeeId = this.userInfo.id
			let connStatus = uni.getStorageSync("_websocket_connect_status")
			if (connStatus && connStatus == "connect") {
				this.initMenu()
			}
			// this.getEmployee()
			this.getSuppliers();
			this.getCustomNumber()
			this.scan(1)
			// this.tableData = this.getData()
			console.log(this.userInfo)
		},
		methods: {
			productDrawerCancel() {
				console.log('您点击了取消按钮')
				this.productDrawerShow = false;
			},
			//确定
			productDrawerEnsure(){
				console.log('您点击了确定按钮')
				this.searchVal = ''
				if (this.processSelectedIndexs.length = 1) {
					let obj = this.processOPList[this.processSelectedIndexs]
					if (obj) {
						obj.qty = 0
						obj.unitPrice = 0
						obj.areaUnit = "1688"
						obj.processBomId = obj.id
						obj.taxValue = 13
						obj.weightUnit = "40288101710a4c6201710a65913d0002"
						obj.currency = "CNY"
						this.$refs.processTable.clearSelection()
						//this.tableData.push(obj)
						this.initSequence(obj) // 2024-9-10
						this.productDrawerShow = false						
					}
				} else {
					this.$tip.toast('请选择一条记录！')
				}

			},	
			openSubOrder(){
				this.subOrderDrawerShow = true
			},			
			getImage(record) {
				if (record.attachment) {
					return api.getFileAccessHttpUrl(record.attachment.split(',')[0])
				}
			},
			previewImage(e,record,index) {
				// 获取图片列表，这里只有一张图片，可以直接放大
				
				let images = record.attachment.split(',');
				let _images = []
				images.forEach((v)=>{
					_images.push( api.getFileAccessHttpUrl(v)	)
				})
				// 调用uni.previewImage方法进行预览
				uni.previewImage({
				  current: _images[0], // 当前显示图片的http链接
				  urls: _images // 需要预览的图片http链接列表
				});
			  },	
			//取消
			cancel() {
			    console.log('您点击了取消按钮')
			    this.drawerShow = false;
			},			
			//确定
			ensure(){
			    console.log('您点击了确定按钮')
			    this.drawerShow = false;
			},	
				subOrderCancel() {
				    console.log('您点击了取消按钮')
				    this.subOrderDrawerShow = false;
				},
				//确定
				subOrderEnsure(){
				    console.log('您点击了确定按钮')
				    this.subOrderDrawerShow = false;
				},				
			queryAbn(){
				this.drawerShow = true
			},
			changeRemark(){
				this.buttonActions.hiddenReturn = true
				this.buttonActions.hiddenConfirm = false
			},
			handelReturn(){
				this.clearQuery()
				this.repeatPrint=true
				this.getOrderData(1)
				// this.isDetailReturn = false
				this.buttonActions.hiddenProcess = true
				this.buttonActions.hiddenConfirm = true
				this.buttonActions.hiddenDetail = false
				this.buttonActions.hiddenReturn = true
				this.buttonActions.hiddenPrint = false
				this.buttonActions.disabledDetail = true
				this.buttonActions.disabledPrint = true
			},
			changeSearchVal(val) {
				this.addProcess()
			},
			addProcess(){
				let params = {}
				let superArr = []
				superArr.push({"rule":"eq","type":"int","val":1,"field":"opmFlag"})
				params.superQueryMatchType = 'and'
				params.superQueryParams = encodeURIComponent(JSON.stringify(superArr))
				params.queryName = this.searchVal
				this.$http.get('/mrp/mrpProcessBom/list-page',{params:params}).then(res=>{
					console.log("res::receipt list >",res)
				    if (res.data.result.records) {
						this.processOPList = res.data.result.records 
						console.log(this.processOPList)
						if (res.data.result.total) {
							this.processTotal = res.data.result.total						
						} else {
							this.processTotal = 0
						}
						// this.showDrawer('showLeft')
						this.productDrawerShow = true
					}
				})
				
			},
			showDrawer(e) {
				this.$refs[e].open()
			},
			closeDrawer(e) {
				this.searchVal = ''
				if (this.processSelectedIndexs.length = 1) {
					let obj = this.processOPList[this.processSelectedIndexs]
					if (obj) {
						obj.qty = 0
						obj.unitPrice = 0
						obj.areaUnit = "1688"
						obj.processBomId = obj.id
						obj.taxValue = 13
						obj.weightUnit = "40288101710a4c6201710a65913d0002"
						obj.currency = "CNY"
						this.$refs.processTable.clearSelection()
						//this.tableData.push(obj)
						this.initSequence(obj) // 2024-9-10
						this.selectedProcess = true
						
					}
				} else {
					this.selectedProcess = false
				}
				this.$refs[e].close()
			},
			changeDraw(e, type) {
				console.log((type === 'showLeft' ? '左窗口' : '右窗口') + (e ? '打开' : '关闭'));
				this[type] = e
			},
			handelDetail(){
				if (this.selectedIndexs.length == 1) {
					let id = this.orderData[this.selectedIndexs[0]].id
					this.mastData = this.orderData[this.selectedIndexs[0]]
					this.myFormData.supplierId = this.mastData.supplierId_dictText
					let params = {'id':id}
					
					this.loading = true
					this.$http.get('/opm/opmOutsourceProcess/queryOpmOutsourceProcessItemByMainId', {
						params: params
					}).then(res => {
						this.loading = false
						this.tableData = res.data.result.records || res.data.result;
						console.log(this.tableData)
						this.tableData.forEach((v)=>{
							v.item_id = v.id
						})
						if (res.data.result.total) {
							this.total = res.data.result.total						
						} else {
							this.total = 0
						}
						this.repeatPrint = false
						// this.disabledPrint = true
						this.isOrderChange = true
						// this.isAddProcess = true
						// this.disabledDataInputFlag = false
						// this.isDetailReturn = true
						this.buttonActions.hiddenDetail = true
						this.buttonActions.hiddenPrint = true
						this.buttonActions.hiddenReturn = false
						this.buttonActions.hiddenProcess = false
					})
				}
			},
			 handleTouchStart(event) {
			      // 获取触摸点的信息
			      const touch = event.touches[0];
			      const x = touch.clientX;
			      const y = touch.clientY;
			      console.log(`触摸开始，坐标为：(${x}, ${y})`);
				  this.$refs.selSupp.handelDropDown(x,y)
			      // 你可以在这里执行其他逻辑，比如开始滑动的处理等
				        // 创建SelectorQuery对象
				   //      const query = uni.createSelectorQuery().in(this);
				   
				   //      // 选择我们想要检查的元素
				   //      query.selectAll('.some-class').boundingClientRect(data => {
				   //        data.forEach(rect => {
				   //          // 检查点击位置是否在元素内
				   //          if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
				   //            console.log('点击了特定元素', rect);
				   //          }
				   //        });
				   //      }).exec();
			    },
			initMenu() {
				this.onSocketOpen()
				this.onSocketReceive()
			},
			// 启动webSocket
			onSocketOpen() {
				socket.init('websocket');
			},
			onSocketReceive() {
				var _this = this
				socket.acceptMessage = function(res) {
					console.log("页面收到的消息", res);
				}
			},
			handlePrint() {
				// this.disabledPrint = true
				let outsourceNo = this.outsourceNo
				if (this.repeatPrint) {
                   outsourceNo = this.orderData[this.selectedIndexs[0]].outsourceNo
				}
				let obj = {'outsourceNo':outsourceNo}
				let params = {
					'code': '0',
					'name': new Date(),
					'username': this.userInfo.username,
					'printModule': 'xcxOutsourceNoParameter',
					'printParameter': JSON.stringify([obj])
				}
				this.$http.post("/bas/basUserPrintBuffer/add", params).then(res => {						
					uni.navigateTo({
						url: '/pages/index/index'
					})
					this.$tip.toast('打印数据提交成功，等待远程打印！')
				});			
				// socket.send({
				// 	value: "保存成功！",
				// 	application: "print",
				// 	username: uni.getStorageSync(SASS_TENANT_ID) + '-' + this.userInfo.username + '-print',
				// 	userUid: this.userInfo.username,
				// 	domain: uni.getStorageSync(SASS_DOMAIN_ID),
				// 	tenant: uni.getStorageSync(SASS_TENANT_ID),
				// 	outsourceNo: outsourceNo
				// }, null)

			},
			isRowHighlighted(item) {
				// 根据你的条件返回true或false
				// 例如，如果item的某个属性等于特定值，则返回true
				return item.colorProperty == '2';
			},
			saveSuppIndex() {
				let params = {
					'code': '0',
					'name': '0',
					'username': this.userInfo.username,
					'printModule': 'xcxSuppParameter',
					'printParameter': JSON.stringify([this.buffSuppliers])
				}
				this.$http.post("/bas/basUserPrintBuffer/add", params).then(res => {});
			},
					// 分页触发
			changePage(e) {
				this.$refs.table.clearSelection()
				this.selectedIndexs.length = 0
				this.getOrderData(e.current)
			},
			changeProcessPage(e) {
				this.selectedProcess = false
				this.$refs.processTable.clearSelection()
				this.processSelectedIndexs = []
				this.searchVal = ""
				this.getProcessData(e.current)
			},
			getProcessData(pageCurrent) {
				this.processPageCurrent = pageCurrent
				let that = this
				let params = {}
				let superArr = []
				superArr.push({"rule":"eq","type":"int","val":1,"field":"opmFlag"})
				params.superQueryMatchType = 'and'
				params.superQueryParams = encodeURIComponent(JSON.stringify(superArr))
				params.queryName = this.searchVal
				params.pageNo = this.processPageCurrent
				params.pageSize = this.processPageSize
				this.$http.get('/mrp/mrpProcessBom/list-page',{params:params}).then(res=>{
					console.log("res::receipt list >",res)
				    if (res.data.result.records) {
						that.processOPList = res.data.result.records 
						if (res.data.result.total) {
							that.processTotal = res.data.result.total						
						} else {
							that.processTotal = 0
						}
						console.log(that.processOPList)
					}
				})
			},
			getOrderData(pageCurrent) {
				this.pageCurrent = pageCurrent
				let that = this
				let params = {
					'pageNo': this.pageCurrent,
					'pageSize': this.pageSize,
					'column': 'createTime,outsourceNo',					
					'order': 'desc',
				}
				this.loading = true
				this.$http.get("/opm/opmOutsourceProcess/list", {
					params: params
				}).then(res => {
					this.loading = false
					this.orderData = res.data.result.records || res.data.result;
					console.log(this.orderData)
					if (res.data.result.total) {
						this.total = res.data.result.total						
					} else {
						this.total = 0
					}
				})
			},
			getSuppIndex() {
				let that = this
				let params = {
					'username': this.userInfo.username,
					'printModule': 'xcxSuppParameter'
				}
				this.$http.get("/bas/basUserPrintBuffer/list", {
					params: params
				}).then(res => {
					let data = res.data.result.records;
					if (data && data.length > 0 && data[0].printParameter) {
						that.buffSuppliers = JSON.parse(data[0].printParameter)[0];
						console.log("....", that.buffSuppliers)
						let _objs = []
						that.buffSuppliers.forEach((item) => {
							if (item.text == "联新") {
								console.log("buffSuppliers ->" + item.text + " -- " + item.value)
							}							
							item.id
							that.suppliers.forEach((v) => {
								if (v.value == item.value) {
									item.text = v.text
									_objs.push(item)
								}
							})
						}) //删除的供应商
						let _objs1 = []
						that.suppliers.forEach((item) => {
							if (item.text == "联新") {
								console.log("suppliers ->" + item.text + " -- " + item.value)
							}	
							let _obj = that.buffSuppliers.filter(v => v.value == item.value)
							if (_obj == null || _obj.length == 0) {
								_objs1.push(item)
							}
						}) //新添加的供应商
						if (_objs1.length > 0) {
							_objs = _objs.concat(_objs1)
						}

						that.sortSupps = _objs
						that.sortSupps.forEach((v)=>{
							that.sortSuppstext.push(v.text)
						})
						that.buffSuppliers = _objs
					} else {
						that.sortSupps = that.suppliers
						that.sortSupps.forEach((v)=>{
							that.sortSuppstext.push(v.text)
						})
						that.buffSuppliers = that.suppliers
					}
				})
			},
			    onFocus(e) {
				   e.detail.value = ''
			      // e.target.select()
			    },
			setFocus(e) {
	
				let that = this
				this.$nextTick(() => {
					setTimeout(() => {
						that.focusState = true
					}, 1000)
				})
			},
			handleInput2(val) {

			},
			changeSupp(val) {
				this.myFormData.supplierId = val
				// this.buffSuppliers = this.suppliers
				if (this.buffSuppliers.length == 0) {
					this.buffSuppliers = this.suppliers
				}
				let _obj = this.buffSuppliers.filter(item => item.value == val)
				let _objs = this.buffSuppliers.filter(item => item.value != val)
				this.selectedSupp = _obj
				this.buffSuppliers = _obj.concat(_objs)
				this.saveSuppIndex() //保存排序
				console.log((this.buffSuppliers))
				let that = this
				this.$http.get(
					this.url.querySupplierDefaultById + '/' + val, {
						params: {}
					}
				).then((res) => {
					if (res.data.result.basSupplierAddress) {
						that.myFormData.customerAddress = res.data.result.basSupplierAddress.address
					}
					if (res.data.result.basSupplierContacts) {
						that.myFormData.contacts = res.data.result.basSupplierContacts.contacts
						that.myFormData.customerTell = res.data.result.basSupplierContacts.mobilePhone
					}
				});
			},
			changeQty(e) {		
				if (this.selectedProcess) {
					this.$tip.alert('请在明细中输入数量！');
					return
				}
				if (!this.myFormData.workOrderNumber || !this.myFormData.processId) {
					this.$tip.alert('没扫工单数据！');
					return
				}
				if (!this.myFormData) return
				if (!this.myFormData.qty || this.myFormData.qty == 0) return
				if (this.myFormData.qty && this.myFormData.qty == 0) return
				if (this.myFormData.qty > this.myFormData.balanceQty) {
					// this.$tip.alert('数量超出可外发数量！');
					// return
				}
				let that = this;
				if (this.tableData.length == 0) {
					// this.tableData.push(this.myFormData)
					this.initSequence(this.myFormData) //2024-9-10
				} else {
					let flag = false
					this.tableData.forEach((item) => {
						if (item.workOrderProcessId == that.myFormData.id) {
							flag = true
							item.qty = that.myFormData.qty
						}
					})
					if (!flag) {
						// this.tableData.push(this.myFormData)
						this.initSequence(this.myFormData)
					}
				}
			},
			// 多选处理
			selectedItems() {
				return this.selectedIndexs.map(i => this.tableData[i])
			},
			// 多选
			selectionChange(e) {
				console.log(e.detail.index)
				this.selectedIndexs = e.detail.index
			},
			selectionChangeOrder(e){
				let that = this
				this.selectedIndexs = e.detail.index
				if (e.detail.index.length == 1) {
				  // this.disabledPrint = false
				  that.buttonActions.disabledDetail = false
				  that.buttonActions.disabledPrint = false
				} else {
				  // this.disabledPrint = true
				  that.buttonActions.disabledDetail = true
				  that.buttonActions.disabledPrint = true
				}
				if (e.detail.index.length > 0) {
					// this.disabledDataInputFlag = true
				} else {
					// this.disabledDataInputFlag = false
				}
				
			},
			selectionChangeProcess(e) {
				this.processSelectedIndexs = e.detail.index
				if (this.processSelectedIndexs.length>0) {
					this.displayProcessConfirm = true
				} else {
					this.displayProcessConfirm = false
				}
				// this.isDetailReturn = false
				this.buttonActions.hiddenReturn = true
				this.buttonActions.hiddenConfirm = false
			},
			//批量删除
			delTable(index, row, e) {
				// this.selectedIndexs.forEach((u) => {
				// 	console.log(u)
				// 	this.tableData.splice(u, 1)
				// })
				this.tableData.splice(index, 1)
				this.$refs.table.clearSelection()
			},
			getCustomNumber() {
				this.$http.put(
					this.customNumberConfig.ruleUrl + this.customNumberConfig.ruleCode, {
						params: this.myFormData
					}
				).then((res) => {
					// 执行成功，获取返回的值，并赋到页面上
					if (res.data && res.data.result) {
						this.outsourceNo = res.data.result;
					}
				});
			},
			
			getSuppliers() {
				console.log("beging find supplier.")
				this.$http.get(
					"/bas/basSupplier/list", {
						params: {
							pageSize: 1000,
							status:1
						}
					}).then(res => {
					console.log("res::supplier>", res)
					if (res.data.result.records) {
						let data = res.data.result.records
						this.suppliers = []
						data.forEach((item) => {
							let obj = {
								value: item.id,
								text: item.shortName
							}
							this.suppliers.push(obj)
						})
						this.getSuppIndex()
					}
				})
			},
			getEmployee() {
				this.processIds = ''
				console.log("beging find employee.")
				this.$http.get("/bas/basEmployee/list", {
					params: {
						code: this.userInfo.username
					}
				}).then(res => {
					console.log("res::employee>", res)
					if (res.data.result.records[0]) {
						this.processIds = res.data.result.records[0].processIds
					}
				})
			},
			scan(index) {
				let that = this
				this.focusState = false
				console.log("进来了")
				// #ifndef H5
				uni.scanCode({
					success: function(res) {
						const innerAudioContext = uni.createInnerAudioContext();
						innerAudioContext.autoplay = true;
						innerAudioContext.src = 'https://www.suzi-info.com/13193.wav'; //音频地址
						innerAudioContext.onPlay(() => {
							console.log('开始播放');
						});
						innerAudioContext.onError((res) => {
							console.log(res.errMsg);
							console.log(res.errCode);
						});
						let scanDataRes = res.result.split('/')
						if (that.createQrcodeInCad && that.itemChilds.length>0 &&  scanDataRes && scanDataRes.length == 5) {
							if (scanDataRes[4] == "salseorder") {
								that.myFormData.workOrderNumber = scanDataRes[3]
								// that.myFormData.qty = ''	
								that.repeatPrint = false	
								that.getWorkOrderData("salseorder");
							} else {
								let data = that.findWorkOrderNo(scanDataRes[0])
								console.log(data)
								if (data && data.length>0) {
									that.myFormData.workOrderNumber = data[0].workOrderNumber
									that.repeatPrint = false					
									that.getWorkOrderData();
								} else {
									that.notFindWorkOrderNo()
								}
							}							

						} else {
							if (scanDataRes && scanDataRes.length == 5) {
								if (scanDataRes[4] == "salseorder") {
									that.myFormData.workOrderNumber = scanDataRes[3]
									// that.myFormData.qty = ''					
									that.repeatPrint = false
									that.getWorkOrderData("salseorder");
								} else {
									that.notFindWorkOrderNo()
								}
							} else {
								that.myFormData.workOrderNumber = res.result.split('/')[0]
								that.repeatPrint = false
								that.getWorkOrderData();
							}
						}						

						// that.isDetailReturn = false
						if (that.scanSource == "repeatPrint") {
							that.buttonActions.hiddenProcess = true
						} else {
							that.buttonActions.hiddenProcess = false
						}
						that.buttonActions.hiddenDetail = true
						that.buttonActions.hiddenReturn = true
						that.buttonActions.hiddenPrint = true
						that.buttonActions.hiddenConfirm = false
						that.selectedProcess = false
					},					
					fail:function(res) {		
						if (index == 1) {
							that.scanSource = "repeatPrint"
							that.repeatPrint = true
							that.getOrderData(1)
							that.buttonActions.hiddenConfirm = true
							that.buttonActions.hiddenReturn = true
							that.buttonActions.hiddenProcess = false
						    that.buttonActions.hiddenPrint = false
							that.buttonActions.hiddenDetail = false
							that.buttonActions.disabledDetail = true
							that.buttonActions.disabledPrint = true
						}
					}
				});
				// #endif
				// #ifdef H5
				this.$tip.alert("暂不支持")
				// #endif
			},
			findWorkOrderNo(code){
				let data = this.itemChilds.filter(item=>item.code == code)
				return data
			},
			notFindWorkOrderNo() {
				this.$tip.toast('没找到子工单数据')
				this.clearQuery()
				this.itemChilds = []
				this.createQrcodeInCad = false
				this.repeatPrint=true
				this.buttonActions.hiddenProcess = true
				this.buttonActions.hiddenConfirm = true
				this.buttonActions.hiddenDetail = false
				this.buttonActions.hiddenReturn = true
				this.buttonActions.hiddenPrint = false
				this.buttonActions.disabledDetail = true
				this.buttonActions.disabledPrint = true
			},
			change(val) {
				let that = this
				// if (this.selectedId != "" && this.selectedId != val) {					
				// 	uni.showModal({
				// 	    title: '提示',
				// 	    content: '确认执行此操作吗？',
				// 	    success: function (res) {
				// 	        if (res.confirm) {
				// 	            console.log('用户点击确定');
				// 				that.selectedId = val
				// 	            // 这里编写用户点击确定后的代码
				// 	        } else if (res.cancel) {
				// 	            console.log('用户点击取消');
				// 	            // 这里编写用户点击取消后的代码
				// 	        }
				// 	    }
				// 	});
				// }
				// this.myFormData.balanceQty = this.workprocess[val].balanceQty

				//
				let superId = this.myFormData.supplierId
				this.myFormData = Object.assign({}, this.workprocess[val]);
				this.myFormData.supplierId = superId
				this.myFormData.qty = this.myFormData.balanceQty
				this.selectedId = this.myFormData.id
				if (this.myFormData.qty && this.myFormData.qty > 0) {
					this.changeQty()
				}
				that.setFocus()
			},
			getWorkOrderData(scanType) {
				let that = this
				this.itemChilds = []
				this.createQrcodeInCad = false
				this.range = []
				this.myFormData.id = null;
				
				if (!this.myFormData.workOrderNumber) {
					this.$tip.alert('请输入工单号码！');
					return false
				}
				let param = {
					workOrderNumber: this.myFormData.workOrderNumber,
					scanType:scanType
				}
				let supplierId = this.myFormData.supplierId
				this.$http.get("/wom/womWorkOrder/getProcessProgressByNo", {
					params: param
				}).then(res => {
					let _data = res.data.result
					let data = _data.filter(p=> p.status != 3)
					console.log("res::workOrderNumber list>", data)
					if (data && data.length > 0) {
						if (scanType && scanType == "salseorder") {
							this.myFormData.workOrderNumber = data[0].workOrderNumber
						}
						if (data[0].itemChilds && data[0].itemChilds.length>0 && data[0].createQrcodeInCad ) {
							this.itemChilds = data[0].itemChilds;
							this.createQrcodeInCad = data[0].createQrcodeInCad
						}
						if (data[0].abnProductionAbnormalPageList && data[0].abnProductionAbnormalPageList.length >0) {
							this.abnTableData = data[0].abnProductionAbnormalPageList
							this.queryAbnVisual = true
							this.abnTableData.forEach((item,index)=>{
								if (item.attachment) {
									let url = api.getFileAccessHttpUrl((item.attachment).split(',')[0])
									console.log(url)
								}								
							})
						}
						this.processList = []
						this.workprocess = {}
						data.forEach((item) => {
							item.workOrderProcessId = item.id
							item.colorProperty = '2'
							item.unitPrice = 1
							item.balanceQty = (item.qtyOut == null ? 0 : item.qtyOut) - (item
								.qtyOutIssue == null ? 0 : item.qtyOutIssue)
							let obj = {
								value: item.id,
								text: item.processId_dictText
							}
							this.workprocess[item.id] = item
							console.log(item)

							if (item.processAttribute && item.processAttribute == 2) {
								if (item.processRequirement) {
								   obj.text = obj.text + "/" + item.processRequirement
								}
								this.processList.push(obj)								
							}
						})
						console.log(this.workprocess)
						this.range = this.processList
						if (this.processList.length == 0) {
							this.$tip.toast('未找到外发工序！')
							return
						}
						// this.myFormData.id = this.processList[0].value
						this.myFormData = Object.assign({}, this.workprocess[this.processList[0].value]);
						this.myFormData.outsourceNo = this.outsourceNo
						this.myFormData.supplierId = supplierId
						this.myFormData.qty = this.myFormData.balanceQty
						this.selectedId = this.myFormData.id
						let that = this
						if (this.myFormData.qty && this.myFormData.qty > 0 && this.range.length == 1) {
							this.bgColor = 'white'
							this.changeQty()
						} else {
							if (this.range.length > 1) {
								this.bgColor = 'yellow'
							} else {
								this.bgColor = 'white'
							}
						}						
						console.log("this.myFormData:", this.myFormData)
						that.setFocus()
					} else {
						this.$tip.toast('未找到工单数据！')
					}
				})
			},
			initSequence(obj){
				let str = '000' + this.tableData.length
				str = str.substring(str.length - 3);
				obj.sequence = 'S' + str
				this.tableData.push(obj)
				this.tableData.sort((a, b) => b.sequence.localeCompare(a.sequence));
			},
			onSubmit(status) {
				let that = this
				let myForm = this.myFormData
				//  let checkPhone = new RegExp(/^[1]([3-9])[0-9]{9}$/);
				//  let checkEmail = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/;
				//  console.log("myForm",myForm)
				if (this.tableData.length == 0) {
					this.$tip.alert('没有保存的数据！');
					return false
				}
				if (!this.myFormData.supplierId) {
					this.$tip.alert('请选择供应商！');
					return false
				}
				// if(this.myFormData.balanceQty < this.myFormData.qty) {
				// 	this.$tip.toast("数量超出可外发数量！")
				// 	return false
				// }
				// if (!this.myFormData.qtyOut || this.myFormData.qtyOut == 0) {
				// 	this.$tip.toast("没有可以外协的数量！") 
				// 	return false
				// }
				let flag = false
				let errWoProcessids = []
				this.tableData.forEach((item) => {
					// item.workOrderProcessId = item.id
					// delete item.id;
					if (item.balanceQty < item.qty) {
						item.colorProperty = '2'
						errWoProcessids.push(item.workOrderProcessId)
						flag = true
					}
					if (!item.qtyOut || item.qtyOut == 0) {
						flag = true
					}
				})
				if (flag) {
					// this.$tip.toast("数量超出可外发数量!")
					// return false
				}
				console.log(this.tableData)
				this.tableData.forEach((item,index) => {
					// let str = '000' + index
					// str = str.substring(str.length - 3);
					// item.sequence = 'S' + str
					if (!item.item_id) {
					   delete item.id
					}
				})
				console.log(this.tableData)
				let param = {
					outsourceType: "2",
					requestDate: Date.now(),
					status: 2,
					supplierId: this.myFormData.supplierId,
					contacts: this.myFormData.contacts,
					customerAddress: this.myFormData.customerAddress,
					customerTell: this.myFormData.customerTell,
					buyer: this.userInfo.realname,
					needApproved: true,
					outsourceNo: this.outsourceNo,
					orderDate: Date.now(),
					opmOutsourceProcessItemList: this.tableData,
					isAppConfirm:true,
				}
				if (this.isOrderChange) {
					param.id = this.mastData.id
					param.status = this.mastData.status
					param.outsourceType = this.mastData.outsourceType
					param.requestDate = this.mastData.requestDate
					param.supplierId = this.mastData.supplierId
					param.contacts = this.mastData.contacts
					param.customerAddress = this.mastData.customerAddress
					param.customerTell = this.mastData.customerTell
					param.buyer = this.mastData.buyer
					param.needApproved = this.mastData.needApproved
					param.outsourceNo = this.mastData.outsourceNo
					param.orderDate = this.mastData.orderDate
					param.isChangeLog = true
				}
				this.$tip.loading();
				let _url = '/opm/opmOutsourceProcess/add'
				if (this.isOrderChange) {
					_url = '/opm/opmOutsourceProcess/edit'
				}
				this.$http.post(_url, param).then(res => {
					console.log(res)
					this.$tip.loaded();
					if (res.data.success) {
						this.$tip.toast('提交成功')
                        this.clearQuery()
						this.repeatPrint = true
					    this.getOrderData(1)
					    that.buttonActions.hiddenConfirm = true
					    that.buttonActions.hiddenReturn = true
						that.buttonActions.hiddenProcess = true
						that.buttonActions.hiddenDetail = false
						that.buttonActions.hiddenPrint = false
					}
				}).catch(() => {
					this.$tip.loaded();
					this.$tip.error('提交失败')
				});
			},
			clearQuery(){
				this.myFormData = {}
				this.tableData = []
				this.processList = []
				this.range = []
				// this.disabledPrint = false
				// this.isAddProcess = false
				this.selectedIndexs = []
			},
			DateChange(e) {
				this.myFormData.birthday = e.detail.value
			},
			SwitchC(e) {
				this.switchC = e.detail.value
			},
			ChooseImage() {
				var that = this;
				uni.chooseImage({
					count: 4, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: (res) => {
						that.$http.upload(that.$config.apiUrl + that.uploadUrl, {
								filePath: res.tempFilePaths[0],
								name: 'file'
							})
							.then(res => {
								that.myFormData.avatar = res.data.message;
							})
							.catch(err => {
								that.$tip.error(err.data.message)
							});
						this.imgList = res.tempFilePaths
					}
				});
			},
			ViewImage(e) {
				uni.previewImage({
					urls: this.imgList,
					current: e.currentTarget.dataset.url
				});
			},
			DelImg(e) {
				uni.showModal({
					title: '召唤师',
					content: '确定要删除这段回忆吗？',
					cancelText: '再看看',
					confirmText: '再见',
					success: res => {
						if (res.confirm) {
							this.imgList.splice(e.currentTarget.dataset.index, 1)
						}
					}
				})
			},
			onShareAppMessage: async function() {
				if (!this.myFormData.supplierId) {
					this.$tip.toast("没选择供应商，不可以分享链接！");
					return {
						title: "没有分享成功，供应商数据没填！",
						path: '/pages/workorder/deliveryInput',
						success: (res) => {
							console.log('分享成功', res);
						},
						fail: (res) => {
							console.log('分享失败', res);
						}
					};
				} else {
					let uuid = this.generateUUID();
					let companyName = uni.getStorageSync(SASS_DOMAIN_NAME);
					let tenantId = uni.getStorageSync(SASS_TENANT_ID);
					let domainId = uni.getStorageSync(SASS_DOMAIN_ID);
					let supplierId = this.selectedSupp[0].value;
					let param = {
						'uuid': uuid.toString(),
						'tenantId': tenantId,
						'supplierId': supplierId
					};
					param = JSON.stringify(param);
					this.$tip.loading();
					try {
						const res = await this.$http.post(this.url.saveShareLink, param);
						this.$tip.loaded();
						console.log(res)
						if (res.data.success) {
							companyName = res.data.result.companyName || companyName 
							this.$tip.toast('提交成功');
							return {
								title: (companyName ? companyName : tenantId) + ',发送给:' + this.selectedSupp[0].text + '送货信息。',
								path: '/pages/report/suppQueryOpmOrder?uuid=' + uuid + '&tenantId=' + tenantId + '&supplierId=' + supplierId,
								success: (res) => {
									console.log('分享成功', res);
								},
								fail: (res) => {
									console.log('分享失败', res);
								}
							};
						} else {
							this.$tip.error('提交失败');
							return {
								title: "没有分享成功，数据提交失败！",
								path: '/pages/report/suppQueryOpmOrder',
								success: (res) => {
									console.log('分享成功', res);
								},
								fail: (res) => {
									console.log('分享失败', res);
								}
							};
						}
					} catch (error) {
						this.$tip.loaded();
						this.$tip.error('提交失败');
						return {
							title: "没有分享成功，数据提交失败！",
							path: '/pages/report/suppQueryOpmOrder',
							success: (res) => {
								console.log('分享成功', res);
							},
							fail: (res) => {
								console.log('分享失败', res);
							}
						};
					}
				}
			},
			  // 假设使用简易方式生成 uuid
			  generateUUID() {
			    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
			      var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
			      return v.toString(16);
			    });
			  },		
		}
	}
</script>

<style>
	.highlight-row {
		background-color: red;
		/* 你想要的颜色 */
	}

	.cu-form-group .title {
		font-weight: 600;
		min-width: calc(4em + 15px);
	}

	.button-sp-area {
		margin-left: 40%;
		margin-top: 30rpx;
		/* margin: 10 auto; */
		/* width: 60%; */
	}

	.container-btn {
		display: flex;
		justify-content: center;
		/* 水平居中 */
		align-items: center;
		/* 垂直居中 */
		height: 100%;
		/* 父容器需要有确定的高度 */
	}
	.example-body {
		padding: 10px;
	}
	
	.scroll-view {
		/* #ifndef APP-NVUE */
		width: 100%;
		height: 100%;
		/* #endif */
		flex: 1
	}
	
	// 处理抽屉内容滚动
	.scroll-view-box {
		flex: 1;
		position: absolute;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
	}
	.image {
	   width: 30px; /* 设置图片宽度 */
	   height: 20px; /* 设置图片高度 */
	 }	
</style>
